
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="../assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="../css/style.css"/>       
        <link href="../assets/css/codemirror.css" rel="stylesheet">
        <link rel="stylesheet" href="../assets/css/ace.min.css" />
        <link rel="stylesheet" href="../assets/css/font-awesome.min.css" />
          <script src="js/jquery-1.9.1.min.js"></script>
		<script type="text/javascript">
			window.jQuery || document.write("<script src='../assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>
       <script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='../assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="../assets/js/bootstrap.min.js"></script>
		<script src="../assets/js/typeahead-bs2.min.js"></script>
		<!-- page specific plugin scripts -->
		<script src="../assets/js/jquery.dataTables.min.js"></script>
		<script src="../assets/js/jquery.dataTables.bootstrap.js"></script>
        <script type="text/javascript" src="../js/H-ui.js"></script> 
        <script type="text/javascript" src="../js/H-ui.admin.js"></script> 
        <script src="../assets/layer/layer.js" type="text/javascript" ></script>
        <script src="../assets/laydate/laydate.js" type="text/javascript"></script>
		<script src="../js/jquery-1.9.1.min.js"></script>
<script type="text/javascript">


     function jiedai(){
    
         var id=document.ff.ace.value;
       if(id==null || id=="")
       {
           alert("请选择编号");
       }else{
           
          ff.action="../receive/jiedai.do";
          ff.submit(); 
       
       }
     
     }


      function rengou(){
    
         var mid=document.ff.ace.value;
        var state=document.getElementById("st"+mid).innerText;  
      
        
      if(mid==null || mid=="")
       {
           alert("请选择编号");
       }else{
       
         
	if (state == '草稿') {
	   		$.ajax({
					url : "toajax5.do",
					type : "post",
					dataType : "text",
					data : {mid:mid},
					success : function(rs){
						var a=rs;
						if (a == '已开盘'){
                           /*  alert(11); */
							ff.action = "../indent/add.do";
							ff.submit();
						}else{
						  alert("该房间已被认购或签约请更改房间");
						}

					},
					error : function() {
						alert("error");
					}
				});

			} else {

				alert("状态不满足当前操作");
			}

		}

	}

	function qianyue() {
		var id = document.ff.ace.value;
		if (id == null || id == "") {
			alert("请选择编号");
		} else {
			var state = document.getElementById("st" + id).innerText;
			if (state == '草稿' || state == '关闭') {
				ff.action = "../bargain/addbargain.do";
				ff.submit();
			}else if(state == '认购'){
			
			alert("该状态为认购状态需到订单中转签约");
			
			}else {

				alert("状态不满足当前操作");
			}
		}
	}

	function bianji() {

		var id = document.ff.ace.value;

		if (id == null || id == "") {
			alert("请选择编号");
		} else {

			var state = document.getElementById("st" + id).innerText;

			if (state == '草稿' || state == '关闭') {
				ff.action = "../marketing/update.do";
				ff.submit();
			} else {

				alert("状态不满足当前操作");
			}
		}

	}

	function shanchu() {

		var id = document.ff.ace.value;

		if (id == null || id == "") {
			alert("请选择编号");
		} else {
           
			var state = document.getElementById("st" + id).innerText;
			if (state == '草稿' || state == '关闭') {

				layer.confirm('确认要删除吗？', function(index) {

					$(document.getElementById("s" + id)).remove();

					layer.msg('已删除!', {
						icon : 1,
						time : 1000
					});
					window.location.href = "../marketing/delete.do?ace=" + id;

				});

			} else {

				alert("当前状态不可删除");
			}
		}

	}
</script>

<title>订单列表</title>
</head>

<body>
<div class="page-content clearfix">
    <div id="Member_Ratings">
      <div class="d_Confirm_Order_style">
    <div class="search_style">
      <ul class="search_content clearfix">
      <form action="select.do" method="post"> 
       <li> <label class="l_f">机会名称：</label>
      <input type="text" name="name"></input></li>
       <li> <label class="l_f">客户姓名：</label>
      <input type="text" name="clientname"></input>
     
       <li style="width:90px;"><button type="submit" class="btn_search">查询</button></li>
     </form>
      </ul>
      
      
      
    </div>
   <!-- member_del(this,${list.id}) -->
     <div class="border clearfix">
       <span class="l_f">
        <a href="../marketing/add.do" class="btn btn-xs btn-info"><i class="fa fa-check  bigger-120">添加</i></a>
        <a title="删除" onclick="shanchu()" class="btn btn-warning">删除</a>    
         <a title="编辑 " onclick="bianji()" class="btn btn-xs btn-success"><i class="fa fa-check  bigger-120">编辑</i></a>
       </span>
       <span style="margin-left:22cm;">
       
       <a onclick="rengou()" class="btn btn-xs btn-info"><i class="fa fa-check  bigger-120">转认购</i></a>
       <a onclick="qianyue()"  class="btn btn-warning">转签约</a>
       <a onclick="jiedai()" class="btn btn-xs btn-success"><i class="fa fa-check  bigger-120">接待记录</i></a>  
        </span>  
     </div>
    <form name="ff">
     <div class="table_menu_list">
       <table class="table table-striped table-bordered table-hover" id="sample-table">
		<thead>
		 <tr>
				<th width="25"><label><input type="radio" class="ace" name="ace" value=""/><span class="lbl"></span></label></th>
				<th width="80">ID</th>
				<th width="100">机会名称</th>
				<th width="200">意向描述</th>
				<th width="300">意向房间</th>
				<th width="200">客户姓名</th>
				<th width="200">客户电话</th>
				<th width="120">业务员编号</th>
				<th width="120">业务员</th>
				<th width="50">状态</th>            
			<!-- 	<th width="300">操作</th> -->
			</tr>
		</thead>
	<tbody>

		
		<c:forEach items="${marketinglist}" var="list">
		<tr id="t${list.id}">
          <td><label><input type="radio" class="ace"  name="ace" value="${list.id}"/><span class="lbl"></span></label></td>
          <td>${list.id}</td>
          <td>${list.name}</td>
          <td>${list.intention}</td>
          <td>${list.complexname}#${list.unitname}#${list.roomname}</td>
           <td>${list.clientname}</td>
            <td>${list.clinetelephone}</td>
             <td>${list.userid}</td>
              <td>${list.username}</td>
           <td id="st${list.id}">${list.state}</td>
        <!--   <td class="td-manage">  -->
         
          </td>
		</tr> 
		
		</c:forEach>
      
      </tbody>
	</table>
	</form>
   </div>
  </div>
 </div>
</div>
</body>


</html>




